package vsy.buzzwordbingo.model.impl;

import java.util.ArrayList;
import java.util.List;

import vsy.buzzwordbingo.model.Buzzword;
import vsy.buzzwordbingo.model.Game;
import vsy.buzzwordbingo.model.GameBoard;
import vsy.buzzwordbingo.model.Link;
import vsy.buzzwordbingo.model.Player;

public class BoardBuilder {
	private List<BuzzwordBuilder> buzzwords;
	private int size;
	private String id;
	private PlayerBuilder player;
	private GameBuilder game;
	private LinkBuilder link;
	
	public GameBoard createBoard() {
		ArrayList<Buzzword> b = new ArrayList<Buzzword>(buzzwords.size());
		for (BuzzwordBuilder builder : buzzwords) {
			b.add(builder.createBuzzword());
			
		}
		Player p = (this.player == null) ? null : this.player.createPlayer();
		Game g = (this.game == null ) ? null : this.game.createGame();
		return new GameBoardImpl(id, p, g, size, b);
	}
	
	public Link getLink() {
		if (link == null)
			return null;
		return link.createLink();
	}
}
